<?php
/**
 * Cms.php
* 跨境电商商城系统
 * =============================================
 * Copy right 2016-2026 大连熠泽科技网络有限公司
 * ---------------------------------------------
 * 官方网址: http://www.yizehuitong.com
 * =============================================
 * @author : yizehuitong
 * @date : 2019.10
 * @version : v2.0
 */

namespace app\admin\controller;


use data\service\VirtualGoods as VirtualGoodsService;

/**
 * 虚拟商品
 */
class VirtualGoods extends BaseController
{
	/**
	 * 获取虚拟商品列表
	 */
	public function virtualGoodsList()
	{
		
		if (request()->isAjax()) {
			$virtualGoods = new VirtualGoodsService();
			$page_index = request()->post('page_index', 1);
			$page_size = request()->post('page_size', PAGESIZE);
			$search_name = request()->post('search_name', '');
			$use_status = request()->post('use_status', '');
			$virtual_code = request()->post('virtual_code', '');
			
			$condition = array();
			if ($search_name != '') {
				$condition["ng.goods_name"] = array(
					'like',
					'%' . $search_name . '%'
				);
			}
			if ($virtual_code != '') {
				$condition["nvg.virtual_code"] = $virtual_code;
			}
			if ($use_status != '') {
				$condition["nvg.use_status"] = $use_status;
			}
			$order = "nvg.virtual_goods_id desc";
			$list = $virtualGoods->getVirtualGoodsList($page_index, $page_size, $condition, $order);
			return $list;
		}
		
		$type = request()->get('type', '');
		
		return view($this->style . "VirtualGoods/virtualGoodsList");
	}
}